package cn.cdu.medical.controller;

import cn.cdu.basics.baseVo.Result;
import cn.cdu.medical.entity.PrescriptionDetail;
import cn.cdu.medical.service.IPrescriptionDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 处方明细控制器
 */
@Api(tags = "处方明细接口")
@RestController
@RequestMapping("/zwz/prescription-detail")
@RequiredArgsConstructor
public class PrescriptionDetailController {
    
    private final IPrescriptionDetailService prescriptionDetailService;
    
    @ApiOperation("根据就诊记录ID查询处方明细")
    @GetMapping("/list")
    public Result<List<PrescriptionDetail>> getPrescriptionDetails(
            @ApiParam("就诊记录ID") @RequestParam String medicalRecordId) {
        List<PrescriptionDetail> details = prescriptionDetailService.getByMedicalRecordId(medicalRecordId);
        return Result.success(details);
    }
} 